<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>1外间距测试</title>
    <style>
        /*去除 body的默认外边距*/
        body{
            margin: 0;
        }
        .fu{
            background-color: rgba(255,255,0,.3);
            overflow: hidden;
        }
        .fu>div{
            width: 100px;
            height: 100px;
            border: 2px solid #00f;
            background-color: rgba(0,0,255,.6);
            color: #fff;
        }

        .z1{
            margin-bottom: 15px;
            margin-top: 50px;
        }
        /*z1已经到顶，挤开了z234*/
        .z2{
            margin-top: 50px;
        }
        .z4{
            margin-bottom:50px;
        }
        /* 取大的，重叠*/
        .z3{
            margin: 10px 20px 30px;
        }
        /*顺时针赋值，没有找对门*/
        .z3{
            margin: 0 auto;
        }
        /*上下不变，左右居中*/
        span{
            border: 2px solid #f00;
        }
        .s2{
            /*margin-left: 20px;
            margin-right: 20px;
            margin-bottom: 30px;
            padding-top: 30px;*/
            margin: 30px 20px;
        }/*行内元素水平外间距可以生效，垂直方向不生效*/
    </style>
</head>
<body>
<span>span1</span>
<span class="s2" >span2</span>
<span>span3</span>
<div class="fu">
    <div class="z1">子元素div1</div>
    <div class="z2">子元素div2</div>
    <div class="z3">子元素div3</div>
    <div class="z4">子元素div4</div>
</div>
</body>
</html>